<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chartHainan.vue';
import { merchantMapList,merchantAreaShopTypeMapList } from "@/api/index";
import handleGetData from "@/mixins/handleGetData";
export default {
  mixins: [handleGetData],
  data () {
    return {
      areaId:'',
      cdata: [
        {
          // 名字需要与 “common/map/fujian.js” 地图数据文件里面定义的一一对应，不能是 “福州” 或者 “闽” 之类的缩写
          name: '秀英区',
          value: 10,
          elseData:{
            // 这里放置地图 tooltip 里想显示的数据
          }
        },
        {
          name: '龙华区',
          value: 9,
        },
        {
          name: '琼山区',
          value: 8,
        },
        {
          name: '美兰区',
          value: 7,
        },
      ]
    }
  },
  components: {
    Chart,
  },
  mounted () {
    this.areaId = localStorage.getItem('areaId')
    // this.getMerchantMapList()
    this._handleData();
    this.getData();
  },
  methods: {
    getData() {
      this.getMerchantMapList();
    },
    getMerchantMapList() {
      //获取地图数据
      const params = {
        areaId: this.areaId
      };
      merchantAreaShopTypeMapList(params).then((res) => {
        // console.log('地图数据',res.result)
        // this.cdata = res.result
        let list = res.result
        let arr = []
        list.forEach(item => {
          if(item.cityCode=='460100'){
            console.log(item)
            arr = arr.concat(item)
          }
        });
        // console.log(arr)
        this.cdata = arr
      });
    },
  }
}
</script>

<style lang="scss" scoped>
</style>